package com.tencent.wxpay.service;

import com.tencent.wxpay.common.Configure;
import com.tencent.wxpay.common.Util;
import com.tencent.wxpay.protocol.request.UnifiedOrderReqData;
import com.tencent.wxpay.protocol.response.UnifiedOrderResData;

/**
 * 统一下单接口
 */
public class UnifiedOrderService extends BaseService {

    /**
     * 统一下单接口构造方法，设置接口url
     * @throws ClassNotFoundException
     * @throws IllegalAccessException
     * @throws InstantiationException
     */
    public UnifiedOrderService() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        super(Configure.UNIFIED_ORDER_API);
    }

    /**
     * 请求统一下单接口
     * @param unifiedOrderReqData 这个数据对象里面包含了API要求提交的各种数据字段
     * @return API返回的数据
     * @throws Exception
     */
    public String request(UnifiedOrderReqData unifiedOrderReqData) throws Exception {
        return sendPost(unifiedOrderReqData);
    }
}
